// components/popup/popup.js
Component({
    /**
	 * 组件的属性列表
	 */
    properties: {
        name: {
            type:String,
            value:''
        },
        src: {
            type:String,
            value:''
        },
        width:{
            type:String,
            value:'98'
        },
        height:{
            type:String,
            value:'98'
        }
    },
    /**
	 * 组件的初始数据
	 */
    data: {
        userName:'',
        colorList:['#B4EBFF','#D4BEFF','#FFB3E3','#FFCDB3','#bcd9ff','#ffbec2','#ffdfb9'],
        color:''
    },
    created(){
        console.log(this.properties.name,this.properties.img,'调用啦调用啦')
    },
    ready(){
        console.log(this.properties.name, 'propertiesproperties')
        this.setData({
            userName:this.properties.name.substring(this.properties.name.length-2,this.properties.name.length)
        })
        console.log(this.data.userName, '切割好的内容')
        this.setData({
            color:this.data.colorList[Math.floor(Math.random() * 7)]
        })
        wx.getStorage({
            key:'color',
            success:((res)=>{
                console.log(res.data,'resres')
                this.setData({
                    color: res.data
                })
            })
        })
        wx.setStorage({
            key: 'color',
            data: this.data.color,
        })
    },
    /**
	 * 组件的方法列表
	 */
    methods: {
    }
})